﻿
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using Library.WebControls.SimpleButton;

namespace Library.WebControls.SimpleUpload {
	internal sealed class DivUpload : HtmlGenericNaming {

		public DivUpload()
			: base("div") {
			//var div = new HtmlGenericControl("Div");
		//	div.Style[HtmlTextWriterStyle.Position] = "relative";
		//	Controls.Add(div);
			Attributes["class"] = "spupload";
			_divUploadText = new HtmlGenericControl("div");
			_divUploadText.Attributes["class"] = "spuploadText";
		//	div.Controls.Add(_divUploadText);
				Controls.Add(_divUploadText);
			_textUpload = new TextBox { Enabled = false };
			var divText = new HtmlGenericControl("Div");
			_divUploadText.Controls.Add(divText);
			//_divUploadText.Controls.Add(_textUpload);
			divText.Controls.Add(_textUpload);
			_textUpload.ID = "textUpload";
			_divUploadButton = new HtmlGenericControl("div");
			_divUploadButton.Attributes["class"] = "spuploadbutton";
		//	div.Controls.Add(_divUploadButton);
				Controls.Add(_divUploadButton);
			_fileUpload = new FileUpload { ID = "fileUpload", CssClass = "sphiddenupload" };
			_fileUpload.Attributes["size"] = "1";
			_buttonUpload = new SpButton { ID = "buttonUpload" };
			_buttonUpload.DivButton.Controls.Add(_fileUpload);
			_divUploadButton.Controls.Add(_buttonUpload);
		}

		private readonly HtmlGenericControl _divUploadText;
		private readonly HtmlGenericControl _divUploadButton;
		private readonly SpButton _buttonUpload;
		private readonly TextBox _textUpload;
		private readonly FileUpload _fileUpload;
		internal TextBox TextUpload {
			get { return _textUpload; }
		}
		internal SpButton ButtonUpload {
			get { return _buttonUpload; }
		}
		internal FileUpload FileUpload {
			get { return _fileUpload; }
		}
	}
}
